void _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column);
void _gtk_tree_view_column_unrealize_button (GtkTreeViewColumn *column);
+
void _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
GtkTreeView *tree_view);
-void _gtk_tree_view_column_set_width (GtkTreeViewColumn *column,
- int width,
- int internal_width);
+void _gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
+ int x_offset,
+ int width,
+ int cell_width);
void _gtk_tree_view_column_unset_model (GtkTreeViewColumn *column,
GtkTreeModel *old_model);
void _gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column);
GtkTreeView *tree_view;
GList *list, *first_column, *last_column;
GtkTreeViewColumn *column;
- GtkAllocation allocation;
GtkAllocation widget_allocation;
gint width = 0;
gint extra, extra_per_column, extra_for_last;
first_column = first_column->next)
;
- allocation.y = 0;
- allocation.height = tree_view->priv->header_height;
-
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
/* find out how many extra space and expandable columns we have */
{
GtkWidget *button;
GdkWindow *window;
- gint real_requested_width = 0;
gint internal_column_width = 0;
gint old_width, column_width;
continue;
}
- real_requested_width = gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
-
- allocation.x = width;
+ column_width = gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
if (gtk_tree_view_column_get_expand (column))
{
{
/* We add the remander to the last column as
* */
- real_requested_width += extra;
+ column_width += extra;
}
else
{
- real_requested_width += extra_per_column;
+ column_width += extra_per_column;
extra -= extra_per_column;
number_of_expand_columns --;
}
else if (number_of_expand_columns == 0 &&
list == last_column)
{
- real_requested_width += extra;
+ column_width += extra;
}
/* In addition to expand, the last column can get even more
* extra space so all available space is filled up.
*/
if (extra_for_last > 0 && list == last_column)
- real_requested_width += extra_for_last;
+ column_width += extra_for_last;
/* XXX This needs to account the real allocated space for
* the internal GtkCellArea
*/
- internal_column_width = real_requested_width /* - all the stuff treeview adds around the area */;
+ internal_column_width = column_width /* - all the stuff treeview adds around the area */;
- _gtk_tree_view_column_set_width (column, real_requested_width, internal_column_width);
+ _gtk_tree_view_column_allocate (column, width, column_width, internal_column_width);
- column_width = gtk_tree_view_column_get_width (column);
- allocation.width = column_width;
width += column_width;
if (column_width > old_width)
column_changed = TRUE;
-
- button = gtk_tree_view_column_get_button (column);
- window = _gtk_tree_view_column_get_window (column);
-
- gtk_widget_size_allocate (button, &allocation);
-
- if (window)
- gdk_window_move_resize (window,
- allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
- allocation.y,
- TREE_VIEW_DRAG_WIDTH, allocation.height);
}
/* We change the width here. The user might have been resizing columns,
}
void
-_gtk_tree_view_column_set_width (GtkTreeViewColumn *tree_column,
- int width,
- int internal_width)
+_gtk_tree_view_column_allocate (GtkTreeViewColumn *tree_column,
+ int x_offset,
+ int width,
+ int cell_width)
{
GtkTreeViewColumnPrivate *priv;
+ GtkAllocation allocation;
+ gboolean rtl;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
priv = tree_column->priv;
- gtk_cell_area_context_allocate (priv->cell_area_context, internal_width, -1);
priv->width = width;
+ gtk_cell_area_context_allocate (priv->cell_area_context, cell_width, -1);
+
+ allocation.x = x_offset;
+ allocation.y = 0;
+ allocation.width = width;
+ allocation.height = _gtk_tree_view_get_header_height (GTK_TREE_VIEW (priv->tree_view));
+
+ gtk_widget_size_allocate (priv->button, &allocation);
+
+ if (priv->window)
+ {
+ rtl = (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL);
+ gdk_window_move_resize (priv->window,
+ allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
+ allocation.y,
+ TREE_VIEW_DRAG_WIDTH, allocation.height);
+ }
+
g_object_notify (G_OBJECT (tree_column), "width");
}